package com.jk.service.impl;


import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.ModelMap;

import tk.mybatis.mapper.entity.Example;
import tk.mybatis.mapper.entity.Example.Criteria;

import com.jk.pojo.Industry;
import com.jk.service.IndustryService;
import com.jk.service.impl.BaseServiceImpl;

@Service
@Transactional
public class IndustryServiceImpl extends BaseServiceImpl<Industry> implements IndustryService {

	@Override
	public List<Industry> listByCondition(HttpServletRequest request,  ModelMap modelMap) {
		String searchText = String.valueOf(request.getParameter("searchText"));

		Example example = new Example(Industry.class);

		Criteria criteria2 = example.createCriteria();
		criteria2.andLike("name", "%"+searchText+"%");
		Criteria criteria3 = example.createCriteria();
		criteria3.andLike("description", "%"+searchText+"%");
		example.or(criteria3);
		example.setOrderByClause(" id asc");
		return mapper.selectByExample(example);
	}

}
